# -*- coding: utf-8 -*-

import pandas
import requests
import re
from matplotlib import pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
# from sina来自新浪的外汇数据.分析 import analysis_amplitude_num
import time
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.font_manager import FontProperties

font = FontProperties(fname=r"C:\Windows\Fonts\simhei.ttf", size=14)

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from sina来自新浪的外汇数据.分析 import anllysis_bollin
import random


def show_1D_bollin(data=None):
    # {"布林上带": bollin_upper, "当前值": closed[-1],"布林下带": bollin_lower,'布林中值':bollin_middle}
    plt.clf()
    a = data["布林上带"]
    b = data['布林中值']
    c = data['布林下带']
    x = data['当前值']
    print(x)

    plt.title(u'1分钟布林带1400周期', FontProperties=font)

    plt.hist(a, bins=100, color='b')  # , c="red" , normed=True)
    plt.hist(b, bins=100, color='y')  # , c="red" , normed=True)
    plt.hist(c, bins=100, color='g')  # , c="red" , normed=True)
    # random.random()+1
    plt.axvline(x=x, ls="-", c="red")  # 添加垂直直线
    plt.pause(0.1)


if __name__ == '__main__':
    for i in range(1000):
        a = anllysis_bollin()
        show_1D_bollin(a)
        time.sleep(2)

